package main

import "fmt"

func main() {
	// 数字遍历
	for i := 0; i < 10; i++ {
		fmt.Println(i)
	}

	count := 0
	for count < 10 {
		fmt.Println(count)
		count++
	}

	// 数组遍历
	list := []string{"a", "b", "c"}
	for _, value := range list {
		if value == "a" {
			continue
		}
	}

	list_numbers := [6]int{1, 2, 3, 5}
	for index, value := range list_numbers {
		if value == 2 {
			fmt.Printf("第 %d 位 x 的值 = %d\n", index, value)
			break
		}
	}

	// map对象遍历
	dicts := map[string]int{
		"a": 1,
		"b": 2,
		"c": 3,
	}
	for index, value := range dicts {
		fmt.Printf("第 %s 位 x 的值 = %d\n", index, value)
	}

}
